compute node reward based on scheduler time #709
Merged
+57
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Actually the node_reward transaction is sent based on a configurable interval. n production this interval is set to 1 transaction per day.
In the reward calculation we get the number of days of the current month and divide 50 by this number. This fit well for production configuration but if the node_reward transaction are sent in a different interval than once a day, the reward calculation is not accurate.
We should divide the monthly reward amount (currently 50$) by the number of interval in the current month
Note:
I saw that sometimes it can take a little bit of time to compute, so I decided to do he computation in compile time to not slow down the execution.
Fixes #693
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
The function that will provide the number of occurrences per month was tested with doctests, the reward function in itself is already tested I don't think we should test the calculus in itself but more the behaviour (which is already the case).
Checklist: